<?php
/**
* エラーチェッククラス
**/
require_once( '../system/Class_M_DAO.php' );
class Class_M_COST_DM_COUNT extends Class_M_DAO {
	//protected properties begin
	/**
	 *
	 * テーブル名
	 *
	 * @access    protected
	 * @var       string
	 *
	 */
	protected $_table  = "M_COST_DM_COUNT";
	
	/**
	 *
	 * 主キー名
	 *
	 * @access    protected
	 * @var       string
	 *
	 */
	protected $_pkey   = "id";
	
	/**
	 *
	 * ソート順
	 *
	 * @access    protected
	 * @var       string
	 *
	 */
	 protected $_order = "id";
	
	 protected $_cols  = array(
		"matrix_cd"     => array(AOKI_VARTYPE_STR),
		"shop_cd"         => array(AOKI_VARTYPE_STR),
		"dm_no"          => array(AOKI_VARTYPE_STR),
		"count"         => array(AOKI_VARTYPE_STR)
	 );
	
	 protected $_checks  = array(
		"matrix_cd"    => array( "EXIST" ),		
		"shop_cd"         => array( "EXIST" ),
		"dm_no"         => array( "EXIST","NUM" ),
		"count"         => array( "EXIST","NUM"  ),
		"sort"          => array( "EXIST" ),
	 );
	 
	 //maxlength 
	 protected $_maxlens  = array(
		"shop_cd "      =>  3 ,
		"dm_no"      =>  10 
	 );
	
	 public function search($where ,&$page = NULL ){	
	 	
		$sql = "SELECT a.*,b.shop_name,(select  user_name FROM M_LOGIN where id  = a.u_user) as m_user_name from {$this->_table}  a ";
		$sql = $sql. " inner join M_SHOP  b on a.shop_cd = b.shop_cd" ;
		return  parent::search($where ,$page ,$sql);
	}
	
}

?>